import java.util.Random;
import java.util.Scanner;

public class MentalArithmetic {
    static Scanner stdIn=new Scanner(System.in);
    static boolean confirmRetry(){
        int cont;
        do {
            System.out.println("再来一次？<1...Yes/0...No>");
            cont=stdIn.nextInt();

        }while (cont!=0&&cont!=1);
        return cont==1;
    }

    public static void main(String[] args) {
        Random rand=new Random();
        System.out.println("心算能力训练");
        do {
            int x=rand.nextInt(900)+100;
            int y=rand.nextInt(900)+100;
            int z=rand.nextInt(900)+100;
            while(true){
                System.out.println(x+"+"+y+"+"+z+"=");
                int k=stdIn.nextInt();
                if (k==x+y+z)
                    break;
                System.out.println("回答错误");
            }

        }while(confirmRetry());
    }
}
